package com.jh.loadbalance.server.mvc.interceptor;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.util.concurrent.TimeoutException;

@Component
public class CircuitBreakerHandlerInterceptor implements HandlerInterceptor {

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        /*if ("/middle/message".equals(request.getRequestURI()) && ex instanceof TimeoutException) {
            PrintWriter writer = response.getWriter();
            writer.write("Fault");
            writer.flush();
        }*/
    }

}
